package codegenerator.generator;

import org.slf4j.Logger;

import baytony.util.log.Log;
import codegenerator.CodeGeneratorException;
import codegenerator.FileBean;
import codegenerator.TableInfo;
import codegenerator.XmlFileBean;

public class WebServletCtxGenerator extends XmlGenerator {
	
	private static final Logger logger = Log.getLogger();
	private static final String APP_CTX = "web-servlet.jtmp";	
	private static final String PACKAGE_SCAN = "#PackageScan#";
	
	

	@Override
	public FileBean createInfo(TableInfo...tables) throws CodeGeneratorException {
		String jtmpContent = super.readJtmp(APP_CTX);
		jtmpContent = jtmpContent.replaceAll(PACKAGE_SCAN, generatorHelper.getPackageScanPath());
		FileBean result = new XmlFileBean();
		result.setFileName("web-servlet");		
		result.setContent(jtmpContent);
		result.setPath(generatorHelper.getConfigOutputPath());
		return result;
	}

}
